dnd: Fix issues with drag icons under Wayland
authorMatthias Clasen <mclasen@redhat.com>
Tue, 1 Dec 2015 15:34:26 +0000 (10:34 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 2 Dec 2015 04:47:56 +0000 (23:47 -0500)
commit5bb12474d975ee4b790c56e907e4e627120955a0
treea9d2feffd111455cda0d53bbd0477cc62a8a163a
parentfff8297a50e23481d2df72d123f2a84e34a866be
dnd: Fix issues with drag icons under Wayland

The Wayland dnd surface must remain in place until the drag
is over. Setting it directly as the hardcoded window of the
widget we construct carries the danger that it might get
destroyed prematurely, e.g. when the application calls
gtk_drag_set_icon_name more than once and we recreate the
widget.

Instead, create a dedicated toplevel, and reparent the widget
into it. To keep the code simple, we use the same approach
under X11 as well, and make it the responsibility of the
GDK dnd code to keep the window position updated. We already
pass the current pointer position to gdk_drag_motion, which
makes this very easy.

As a side-effect of these changes, it is now possible to use
non-toplevel widgets as drag icons.

https://bugzilla.gnome.org/show_bug.cgi?id=748763
gtk/gtkdnd.c